package com.jeespring.elasticsearch.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.io.Serializable;

/**
 * @description ItemDTO
 * @author 张朝阳
 * @date 2021/9/17 17:37
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "item")
public class ItemIndexDTO implements Serializable {
    //商品id，同时也是商品编号
    @Id
    @Field(index = true, store = true, type = FieldType.Keyword)
    private Long id;

    //SKU名称
    @Field(index = true, store = true, type = FieldType.Text, analyzer = "ik_smart")
    private String name;

    //商品价格，单位为：元
    @Field(index = true, store = true, type = FieldType.Double)
    private Long price;

    //商品图片
    @Field(index = false, store = true, type = FieldType.Text)
    private String images;

    //类目名称
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String category;

    //品牌名称
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String brand;

}
